#include "PartialElement.h"

namespace uml {

PartialElement::PartialElement()
    : PartialElement(nullptr) {}

PartialElement::PartialElement(Element* ownerElement)
    : ownerElement_(ownerElement) {}

/// <summary>
/// Deserialize the owner object from a json object
/// </summary>
/// <param name="json"></param>
/// <param name="errorList"></param>
void PartialElement::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (ownerElement_) {
        ownerElement_->fromJson(json, errorList);
    }
}

/// <summary>
/// Serialization the owner object into a json object
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
void PartialElement::toJson(QJsonObject& json) {
    if (ownerElement_) {
        ownerElement_->toJson(json);
    }
}

Element* PartialElement::ownerElement() {
    return ownerElement_;
}

void PartialElement::setOnwerElement(Element* value) {
    ownerElement_ = value;
}

} // namespace uml
